package com.ningxun.rms.web.controller.wechatuser;


import com.ningxun.rms.common.constant.Constants;
import com.ningxun.rms.common.core.controller.BaseController;
import com.ningxun.rms.common.core.domain.AjaxResult;
import com.ningxun.rms.common.core.domain.model.LoginBody;
import com.ningxun.rms.framework.web.service.SysLoginService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/")
public class LoginController extends BaseController {
    @Autowired
    SysLoginService loginService;

    @PostMapping("/login")
    public AjaxResult list(@RequestBody LoginBody loginBody) {
        AjaxResult ajax = AjaxResult.success();
        String token = loginService.wechatLogin(loginBody.getCode());
        ajax.put(Constants.TOKEN, token);
        return ajax;
    }
}
